package com.herui.ota.testcontrol;

import com.herui.ota.entity.UserDept;
import com.herui.ota.pojo.form.DeviceFilterForm;
import com.herui.ota.pojo.form.NoneFilterForm;
import com.herui.ota.service.UserDeptService;
import com.herui.ota.service.iml.BaseService;
import com.mlnx.common.form.PageForm;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.shan.spring.base.CurdBaseController;
import org.shan.spring.base.annotations.SysLog;
import org.shan.spring.mybatis.service.ICurdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

/**
 * Created by amanda.shan on 2020/5/19.
 */
@SysLog(title = "部门")
@Api(value = "部门接口", tags = {"部门接口"})
@RestController
@RequestMapping("/dept")
public class DeptController extends CurdBaseController<UserDept, UserDept, UserDept, NoneFilterForm> {

    @Autowired
    private UserDeptService service;

    @Override
    public ICurdService getService() {
        return service;
    }

    @Override
    public UserDept newInstance(Integer id) {
        UserDept userDept = new UserDept();
        userDept.setId(id);
        return userDept;
    }

    @ApiOperation("导出excel列表")
    @GetMapping("/excel")
    public void getMqttParamById(PageForm pageForm, NoneFilterForm filter, HttpServletResponse response) throws IllegalAccessException {
        BaseService baseService = (BaseService) service;
        baseService.pageExcel( pageForm, filter,response);
    }

}
